<!DOCTYPE html>
<html lang="cmn-Hans-CN">

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta http-equiv="content-type" content="text/html;charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>TODO LIST DEMO</title>
  <link rel="stylesheet" href="style.css">
  <style>
    .demo {
      width: 384px;
      height: 512px;
      float: left;
    }
  </style>
</head>

<body>
  <div class="demo">
    <div id="todo_list" class="todo-list"></div>
  </div>
  <div class="demo">
    <div id="todo_list2" class="todo-list"></div>
  </div>
  <script type="module">
    /**
     * TODOlist模块
     * @module ./todolist.js
     */
    import createList from "./todolist.js";

    /**
     *  @type {String} 目标div的ID
     */
    const TARGET = document.getElementById("todo_list");

    //在目标创建一个TODO List
    createList(TARGET);

    //Sample
    createList(document.getElementById("todo_list2"));

    /**
     * 当网页基本加载完毕，初始化
     */
    document.addEventListener("readystatechange", function () {
      if (document.readyState == "interactive") {

        console.log("documentReady!");

      }
    });

  </script>
  <script nomodule src="todolist.oldversion.js" type="text/javascript"></script>
  <script nomodule type="text/javascript">
    /**
     *  @type {String} 目标div的ID
     */
    var TARGET = document.getElementById("todo_list");

    /**
     * 当网页基本加载完毕，初始化
     */
    document.addEventListener("readystatechange", function () {
      if (document.readyState == "interactive") {

        console.log("documentReady!");

        //在目标创建一个TODO List
        createList(TARGET);

        //Sample
        createList(document.getElementById("todo_list2"));

      }
    });
  </script>
</body>

</html>